﻿<Application 
    x:Class="OneTo50.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dm="clr-namespace:OneTo50.DataModals"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:vm="clr-namespace:OneTo50.ViewModals"
    xmlns:cvt="clr-namespace:OneTo50.Converters"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">

    <!--应用程序资源-->
    <Application.Resources>
        <TextBlock x:Key="APP_ID" Text="db61ea96b0485528" />
        <dm:SystemSetting x:Key="SystemSetting" />
        <!--Objects ViewModel-->
        <vm:RecordViewModel x:Key="RecordViewModel" />
        <vm:RecordViewModel x:Key="WorldRecordsViewModel" />
        <vm:RecordViewModel x:Key="TodayWorldRecordsViewModel" />
        <vm:CountryScoreViewModel x:Key="CountryScoreViewModel" />

        <!--Converters-->
        <cvt:ScoreFormatConverter x:Key="ScoreFormatConverter" />
        <cvt:DateConverter x:Key="DateConverter" />
        <cvt:StarLevelConverter x:Key="StarLevelConverter" />
        <cvt:FlagImageSourceConverter x:Key="FlagImageSourceConverter" />
        <cvt:CountryTipInfoConverter x:Key="CountryTipInfoConverter" />

        <ImageBrush x:Key="GameBackground" ImageSource="/OneTo50;component/Images/Res/GameBackground.png" Stretch="Fill"></ImageBrush>
        <ImageBrush x:Key="PopupBackground" ImageSource="/OneTo50;component/Images/Res/PopupBackground.png" Stretch="Fill"></ImageBrush>
        <ImageBrush x:Key="GreenButtonNormal" ImageSource="/OneTo50;component/Images/Res/GreenButton.png" Stretch="Fill"></ImageBrush>
        <ImageBrush x:Key="GreenButtonActive" ImageSource="/OneTo50;component/Images/Res/GreenButtonSelected.png" Stretch="Fill"></ImageBrush>
        
        <Style x:Key="DigitTextBox" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="/OneTo50;component/fonts/DIGITAL-Regular.ttf#Digiface" />
            <Setter Property="Foreground" Value="Red" />
            <Setter Property="Margin" Value="0" />
            <Setter Property="Padding" Value="0" />
        </Style>

        <Style x:Key="DownCounterTextBox" TargetType="TextBlock" BasedOn="{StaticResource DigitTextBox}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="FontSize" Value="200" />
            <Setter Property="Foreground" Value="White">
            </Setter>
         </Style>

            <Style x:Key="DisplayTimer" TargetType="TextBlock" BasedOn="{StaticResource DigitTextBox}">
            <Setter Property="Foreground" Value="#007900" />
            <Setter Property="FontSize" Value="60" />
        </Style>
        
        <Style x:Key="BackgroundGrid" TargetType="Grid">
            <Setter Property="Background" Value="{StaticResource GameBackground}" />
        </Style>

        <Style x:Key="ShotButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="{StaticResource GreenButtonNormal}" />
            <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="FontFamily" Value="/OneTo50;component/fonts/DIGITAL-Regular.ttf#Digiface"/>
            <Setter Property="FontSize" Value="40"/>
            <Setter Property="FontWeight" Value="ExtraBold"/>
            <Setter Property="Margin" Value="0,0,0,10" />
            <Setter Property="Width" Value="95" />
            <Setter Property="Height" Value="95" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="White"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource GreenButtonActive}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource GreenButtonActive}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="0">
                                <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ScorePivotItem" TargetType="controls:Pivot">
            <Setter Property="FontFamily" Value="/OneTo50;component/fonts/DIGITAL-Regular.ttf#Digiface" />
            <Setter Property="Foreground" Value="Red" />
        </Style>

        <Style x:Key="ListHeaderText" TargetType="TextBlock" BasedOn="{StaticResource DigitTextBox}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="FontSize" Value="40" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="Foreground">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="#005B00" Offset="0"></GradientStop>
                        <GradientStop Color="#007900" Offset="0.35"></GradientStop>
                        <GradientStop Color="#009800" Offset="0.5"></GradientStop>
                        <GradientStop Color="#007900" Offset="0.55"></GradientStop>
                        <GradientStop Color="#005B00" Offset="1"></GradientStop>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ListItemText" TargetType="TextBlock" BasedOn="{StaticResource DigitTextBox}">
            <Setter Property="TextAlignment" Value="Center" />
            <Setter Property="Foreground">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="#005B00" Offset="0"></GradientStop>
                        <GradientStop Color="#007900" Offset="0.35"></GradientStop>
                        <GradientStop Color="#009800" Offset="0.5"></GradientStop>
                        <GradientStop Color="#007900" Offset="0.55"></GradientStop>
                        <GradientStop Color="#005B00" Offset="1"></GradientStop>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="FontSize" Value="30" />
        </Style>
    </Application.Resources>

    <Application.ApplicationLifetimeObjects>
        <!--处理应用程序的生存期事件所需的对象-->
        <shell:PhoneApplicationService 
            Launching="Application_Launching" Closing="Application_Closing" 
            Activated="Application_Activated" Deactivated="Application_Deactivated"/>
    </Application.ApplicationLifetimeObjects>

</Application>